import sys, os

class Pretty:

    def __init__(self, filename, loads, procs, dict):
        self.filename = filename
        self.dict = dict
        self.loads = loads
        self.procs = procs

    def printOut(self):
        i = 0
        for load in self.loads:
            line = "%d"%load
            for proc in self.procs:
                val_line = self.dict[proc]
                val = val_line[i]
                line += "\t%.02f"%val
            print line
            i += 1
        

    def writeOut(self):
        outfile = open(self.filename, 'w')
        i = 0
        for load in self.loads:
            line = "%d"%load
            for proc in self.procs:
                val_line = self.dict[proc]
                val = val_line[i]
                line += "\t%.02f"%val
            outfile.write(line + "\n")
            i += 1        
        

if __name__ == "__main__":

    line = [1,5,9,10,30]
    dict = {}
    dict[1] = line
    line = [5,9,20,8,59]
    dict[2] = line
    print dict
    procs = [1,2]
    loads = [1,4,8,12,16]

    pretty = Pretty("test.out", loads, procs, dict)
    pretty.printOut()
    pretty.writeOut()
    
    
